﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ATEGo
{
    //———————————————————————【打印日志】————————————————————————
    public partial class Executor
    {


        /// <summary>
        /// 直接写cmdlog
        /// </summary>
        /// <param name="content"></param>
        private void WriteCmd(string content)
        {
            This_Form.Invoke(Action_WriteCmdLog, content);
        }
        /// <summary>
        /// 直接写FlowLog
        /// </summary>
        /// <param name="content"></param>
        private void WriteFlow(string content)
        {
            This_Form.Invoke(Action_WriteFlowLog, content);
        }

        private void WriteFlow_Head1(string content)
        {
            WriteFlow($"-----[{content}]-----");
        }
        private void WriteFlow_Head2(string content)
        {
            WriteFlow($"—————[{content}]—————");
        }
        /// <summary>
        /// ——————————————————————————————————————————————————————————
        /// </summary>
        private void WriteFlow_Sperator()
        {
            WriteFlow("——————————————————————————————————————————————————————————");
        }
        /// <summary>
        /// --content
        /// </summary>
        /// <param name="content"></param>
        private void WriteFlow_Content(string content)
        {
            WriteFlow($"--{content}");
        }
        /// <summary>
        /// --#注释命令：
        /// </summary>
        /// <param name="head"></param>
        /// <param name="cmd"></param>
        private void WriteFlow_Zhushi(string head, string cmd)
        {
            WriteFlow($"--#注释命令：[{head}] {cmd}");
        }
        /// <summary>
        /// -->发送命令：
        /// </summary>
        /// <param name="head"></param>
        /// <param name="cmd"></param>
        private void WriteFlow_SendCmd(string head,string cmd)
        {
            WriteFlow($"-->发送命令：[{head}] {cmd}");
        }
        /// <summary>
        /// -->发送命令：
        /// </summary>
        /// <param name="head"></param>
        /// <param name="cmd"></param>
        private void WriteCmd_Cmd(string head, string cmd)
        {
            WriteCmd($"————————————————————————[{head}] {cmd}——————————————————————————————————");
        }
        /// <summary>
        /// --执行结果：
        /// </summary>
        /// <param name="content"></param>
        private void WriteFlow_Result(string content)
        {
            WriteFlow($"<--执行结果：{content}");
        }
        /// <summary>
        /// --执行结果：[success].
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        private bool WriteFlow_Success(string content)
        {
            WriteFlow_Result($"[success]. {content}");
            Running_Cmd["result"] = "success";
            return true;
        }
        /// <summary>
        /// --执行结果：[fail].
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        private bool WriteFlow_Fail(string content)
        {
            WriteFlow_Result($"[fail]. {content}");
            Running_Cmd["result"] = "fail";
            return false;
        }
        /// <summary>
        /// --@等待：
        /// </summary>
        /// <param name="content"></param>
        private void WriteFlow_Waiting(string content)
        {
            WriteFlow($"--@等待：{content}");
        }
        /// <summary>
        /// --@@停止
        /// </summary>
        private void WriteFlow_Stop()
        {
            WriteFlow($"--@@停止：用户主动停止--");
        }
    }
}
